<?php
defined('BASEPATH') OR exit('No direct script access allowed');

class Offline_course extends User_Controller
{

	
	function __construct()
	{
		parent::__construct();
         $this->smarty->assign("current_class", $this->router->fetch_class());
         $this->smarty->assign("current_method",$this->router->fetch_method());
		$this->uid = $this->user_data['id'];
		if( $this->logged_in==0) {header("Location:/");exit;}
	}	

	/**
	 * 线下list
	 * @param  integer $status  [description]
	 * @param  integer $sort    [description]
	 * @param  integer $asc_des [description]
	 * @param  integer $search  [description]
	 * @param  integer $kemu    [description]
	 * @param  integer $limit   [description]
	 * @return [type]           [description]
	 */
	function index($status = 10,$sort = 0,$asc_des = 0,$search = 0, $cate_id=0, $kemu=0, $limit = 0){
		if($this->input->post()){
			$limit = 0;
			$post_data = $this->input->post('category');
			$search = $post_data['search'] ? urldecode($post_data['search']) : 0;
			$review = isset($post_data['status']) ? $post_data['status'] : 0;
			$kemu = (isset($post_data['kemu'])) ? $post_data['kemu'] : 0;
			$cate_id = (isset($post_data['cate_id'])) ? $post_data['cate_id'] : 0;
		}else{
			$search = urldecode($search);
			$page_config['uri_segment'] = 9;
		}
		$this->load->model("Offline_course_model");
		$data = array( 'status' => $status, 'cate_id' => $cate_id, 'kemu'=>$kemu, 'sort' => $sort,'asc_des' => $asc_des,'search' => $search,'limit' => $limit);
		$this->smarty->assign("action", '面授课');
		$offset = 10;
		$current_url = 'http://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];

		$result = $this->Offline_course_model->get_offline_course_list($limit, $offset);
		
		
		$this->load->library('pagination');
		$page_config['base_url'] = '/user/course/offline/'.$data['status'].'/'.$data['sort'].'/'.$data['asc_des'].'/'.$data['search'].'/'.$data['cate_id'].'/'.$data['kemu'];
		$page_config['total_rows'] = $result['total_count'];
		$page_config['per_page'] = $offset;
		$this->pagination->initialize($page_config);
		$pagination = $this->pagination->create_links();
		$this->smarty->assign("wap_url", $this->config->item('wap_url'));
		$this->smarty->assign("current_url", $current_url);
		
		
		$this->smarty->assign("zhiboke", $result['result']);

		$this->smarty->assign("menu", "course");
		$this->smarty->assign("pagination", $pagination);

		$this->smarty->display("user/offline_course.html");
	}


}